﻿package core.player
{
	import com.falanxia.utilitaris.enums.KeyCodes;
	import core.flipper.Flipper;
	import flash.display.DisplayObject;
	import flash.events.KeyboardEvent;
	import flash.events.MouseEvent;
	
	
	public class Player extends DisplayObject
	{
		private var score:int;
		private var multiplier:int = 1;
		
		private var flipper_l:Flipper = new Flipper(true);
		private var flipper_r:Flipper = new Flipper();
		
		// Constructor
		public function Player()
		{
			addEventListener(KeyboardEvent.KEY_DOWN, KeyInput);
			addEventListener(MouseEvent.CLICK, MouseInput);
		}
		
		// Public Functions
		public function AddScore(pointsToAdd:int):void
		{
			ScorePersonal += pointsToAdd * MultiplierPersonal;
		}
		
		// Get / Set
		public function get ScorePersonal():int
		{
			return score;
		}
		public function set ScorePersonal(value:int):void
		{
			score = value;
			ThresholdCheck();
		}
		
		public function get MultiplierPersonal():int
		{
			return multiplier;
		}
		public function set MultiplierPersonal(value:int):void
		{
			multiplier = value;
		}
		
		public function get Flipper_Left():Flipper
		{
			return flipper_l;
		}
		
		public function get Flipper_Right():Flipper
		{
			return flipper_r;
		}
		
		// Protected Functions
		
		// Private Functions
		private function KeyInput(e:KeyboardEvent):void
		{
			if (e.keyCode == KeyCodes.A || e.keyCode == KeyCodes.LEFT || e.keyCode == KeyCodes.NUMPAD_4) Flipper_Left.Action();
			else if (e.keyCode == KeyCodes.D || e.keyCode == KeyCodes.RIGHT || e.keyCode == KeyCodes.NUMPAD_6) Flipper_Right.Action();
		}
		
		private function MouseInput(e:MouseEvent):void
		{
			
		}
		
		private function ThresholdCheck():void
		{
			
		}
		
		// Cleanup
	}

}
